package cn.sxgan.db.mappers;

import cn.sxgan.common.entity.SysMenu;
import cn.sxgan.common.entity.query.SysMenuQuery;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @Description: 菜单权限表映射mapper
 * @Author: sxgan sxgan@foxmail.com
 * @Date: 2024-09-13
 * @Version: 1.0.0
 **/
@Mapper
public interface ISysMenuMapper extends BaseMapper<SysMenu> {
    List<SysMenu> selectSysMenuByCondition(SysMenuQuery query);
    
    /**
     * 更加角色id查询对应菜单ID
     *
     * @param roleId 角色ID
     * @return 菜单ID集
     */
    List<Long> selectMenuIdByRoleId(@Param("roleId") Long roleId);
    
    /**
     * 绑定菜单到角色
     *
     * @param roleId     角色Id
     * @param menuIdList 菜单Id集合
     * @return 绑定结果
     */
    int insertRoleAndMend(@Param("roleId") Long roleId, @Param("menuIdList") List<Long> menuIdList);
    
    /**
     * 通过角色ID查询系统菜单
     *
     * @param roleId
     * @return
     */
    List<SysMenu> selectSysMenuByRoleId(@Param("roleId") Long roleId);
}